package org.byqh.dqeai.controller;

import com.easy.query.core.proxy.AbstractProxyEntity;
import com.easy.query.core.proxy.ProxyEntityAvailable;
import io.swagger.v3.oas.annotations.Operation;
import org.byqh.dqeai.common.Json;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;

public class BaseOpController<
        TEntity extends ProxyEntityAvailable<TEntity, TProxy>,
        TProxy extends AbstractProxyEntity<TProxy, TEntity>
        > extends BaseController<TEntity, TProxy> {

    @RequestMapping(
            value = "update",
            method = {RequestMethod.PUT, RequestMethod.POST}
    )
    @Operation(summary = "根据主键更新")
    public Json<Boolean> update(@RequestBody TEntity entity) {
        return super.update(entity);
    }

    @PostMapping("save")
    @Operation(summary = "添加数据")
    public Json<Boolean> save(@RequestBody TEntity entity) {
        return super.save(entity);
    }
}
